<?php
class CustomModel extends Model
{
    protected 	$_validate=array(
        array("cname","require","cname不能为空"),
        array("rname","require","rname不能为空"),
        array("rid","integer","rid不是整数"),
        array("company","require","company不能为空"),
        array("tel","require","tel不能为空"),
    );

    protected $_auto = array (
        array('active','1'),  // 新增的时候把status字段设置为1
        array('password','md5',1,'function') , // 对password字段在新增的时候使md5函数处理
        array('addtime','getTime',1,'callback'), // 对create_time字段在更新的时候写入当前时间戳
        array('updatetime','getTime',1,'callback'), // 对create_time字段在更新的时候写入当前时间戳
    );
    public   function getTime()
    {
        return date("Y-m-d H:i:s");
    }
}
?>